package cn.itcast.java.thread;

/**
 * Author itcast
 * Date 2021/10/15 9:09
 * Desc TODO
 */
public class ThreadPriorityDemo {
    public static void main(String[] args) throws InterruptedException {
        //创建三个线程
        ThreadPriority train = new ThreadPriority();
        //
        ThreadPriority plane = new ThreadPriority();
        //
        ThreadPriority ship = new ThreadPriority();

        //按序执行 分配优先级别
        Thread th1 = new Thread(train);
        th1.setName("火车");
        th1.setPriority(1);
        th1.start();
        System.out.println(th1.getPriority());
        //飞机 -
        Thread th3 = new Thread(plane);
        th3.setName("飞机");
        th3.setPriority(10);
        th3.start();
        th1.join(1000);
        System.out.println(th3.getPriority());

        Thread th2 = new Thread(ship);
        th2.setName("轮船");
        th2.start();
        System.out.println(th2.getPriority());

    }
}
